<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link href="http://search.cpan.org/s/style.css" rel="stylesheet" type="text/css">
<title>CartConvert(1)</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<h1 id="NAME">NAME</h1>

<p>CartConvert -- convert geodetic coordinates to geocentric or local cartesian</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p><b>CartConvert</b> [ <b>-r</b> ] [ <b>-l</b> <i>lat0</i> <i>lon0</i> <i>h0</i> ] [ <b>-e</b> <i>a</i> <i>f</i> ] [ <b>-w</b> ] [ <b>-p</b> <i>prec</i> ] [ <b>--comment-delimiter</b> <i>commentdelim</i> ] [ <b>--version</b> | <b>-h</b> | <b>--help</b> ] [ <b>--input-file</b> <i>infile</i> | <b>--input-string</b> <i>instring</i> ] [ <b>--line-separator</b> <i>linesep</i> ] [ <b>--output-file</b> <i>outfile</i> ]</p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>Convert geodetic coordinates to either geocentric or local cartesian coordinates. Geocentric coordinates have the origin at the center of the earth, with the <i>z</i> axis going thru the north pole, and the <i>x</i> axis thru <i>latitude</i> = 0, <i>longitude</i> = 0. By default, the conversion is to geocentric coordinates. Specifying <b>-l</b> <i>lat0</i> <i>lon0</i> <i>h0</i> causes a local coordinate system to be used with the origin at <i>latitude</i> = <i>lat0</i>, <i>longitude</i> = <i>lon0</i>, <i>height</i> = <i>h0</i>, <i>z</i> normal to the ellipsoid and <i>y</i> due north.</p>

<p>Geodetic coordinates are provided on standard input as a set of lines containing (blank separated) <i>latitude</i>, <i>longitude</i> (decimal degrees or degrees, minutes and seconds), and <i>height</i> above the ellipsoid (meters); for details on the allowed formats for latitude and longitude, see the <code>GEOGRAPHIC COORDINATES</code> section of GeoConvert(1). For each set of geodetic coordinates, the corresponding cartesian coordinates <i>x</i>, <i>y</i>, <i>z</i> (meters) are printed on standard output.</p>

<h1 id="OPTIONS">OPTIONS</h1>

<dl>

<dt id="r"><b>-r</b></dt>
<dd>

<p>perform the reverse projection. <i>x</i>, <i>y</i>, <i>z</i> are given on standard input and each line of standard output gives <i>latitude</i>, <i>longitude</i>, <i>height</i>. In general there are multiple solutions and the result which minimizes the absolute value of <i>height</i> is returned, i.e., (<i>latitude</i>, <i>longitude</i>) corresponds to the closest point on the ellipsoid.</p>

</dd>
<dt id="l-lat0-lon0-h0"><b>-l</b> <i>lat0</i> <i>lon0</i> <i>h0</i></dt>
<dd>

<p>specifies conversions to and from a local cartesion coordinate systems with origin <i>lat0</i> <i>lon0</i> <i>h0</i>, instead of a geocentric coordinate system. The <b>-w</b> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before <b>-l</b>.</p>

</dd>
<dt id="e-a-f"><b>-e</b> <i>a</i> <i>f</i></dt>
<dd>

<p>specify the ellipsoid via the equatorial radius, <i>a</i> and the flattening, <i>f</i>. Setting <i>f</i> = 0 results in a sphere. Specify <i>f</i> &lt; 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for <i>f</i>. By default, the WGS84 ellipsoid is used, <i>a</i> = 6378137 m, <i>f</i> = 1/298.257223563.</p>

</dd>
<dt id="w"><b>-w</b></dt>
<dd>

<p>toggle the longitude first flag (it starts off); if the flag is on, then on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, <i>N</i>, <i>S</i>, <i>E</i>, <i>W</i>).</p>

</dd>
<dt id="p-prec"><b>-p</b> <i>prec</i></dt>
<dd>

<p>set the output precision to <i>prec</i> (default 6). <i>prec</i> is the number of digits after the decimal point for geocentric and local cartesion coordinates and for the height (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is <i>prec</i> + 5.</p>

</dd>
<dt id="comment-delimiter-commentdelim"><b>--comment-delimiter</b> <i>commentdelim</i></dt>
<dd>

<p>set the comment delimiter to <i>commentdelim</i> (e.g., &quot;#&quot; or &quot;//&quot;). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing and subsequently appended to the output line (separated by a space).</p>

</dd>
<dt id="version"><b>--version</b></dt>
<dd>

<p>print version and exit.</p>

</dd>
<dt id="h"><b>-h</b></dt>
<dd>

<p>print usage and exit.</p>

</dd>
<dt id="help"><b>--help</b></dt>
<dd>

<p>print full documentation and exit.</p>

</dd>
<dt id="input-file-infile"><b>--input-file</b> <i>infile</i></dt>
<dd>

<p>read input from the file <i>infile</i> instead of from standard input; a file name of &quot;-&quot; stands for standard input.</p>

</dd>
<dt id="input-string-instring"><b>--input-string</b> <i>instring</i></dt>
<dd>

<p>read input from the string <i>instring</i> instead of from standard input. All occurrences of the line separator character (default is a semicolon) in <i>instring</i> are converted to newlines before the reading begins.</p>

</dd>
<dt id="line-separator-linesep"><b>--line-separator</b> <i>linesep</i></dt>
<dd>

<p>set the line separator character to <i>linesep</i>. By default this is a semicolon.</p>

</dd>
<dt id="output-file-outfile"><b>--output-file</b> <i>outfile</i></dt>
<dd>

<p>write output to the file <i>outfile</i> instead of to standard output; a file name of &quot;-&quot; stands for standard output.</p>

</dd>
</dl>

<h1 id="EXAMPLES">EXAMPLES</h1>

<pre><code>   echo 33.3 44.4 6000 | CartConvert
   =&gt; 3816209.60 3737108.55 3485109.57
   echo 33.3 44.4 6000 | CartConvert -l 33 44 20
   =&gt; 37288.97 33374.29 5783.64
   echo 30000 30000 0 | CartConvert -r
   =&gt; 6.483 45 -6335709.73</code></pre>

<h1 id="ERRORS">ERRORS</h1>

<p>An illegal line of input will print an error message to standard output beginning with <code>ERROR:</code> and causes <b>CartConvert</b> to return an exit code of 1. However, an error does not cause <b>CartConvert</b> to terminate; following lines will be converted.</p>

<h1 id="SEE-ALSO">SEE ALSO</h1>

<p>The algorithm for converting geocentric to geodetic coordinates is given in Appendix B of C. F. F. Karney, <i>Geodesics on an ellipsoid of revolution</i>, Feb. 2011; preprint <a href="https://arxiv.org/abs/1102.1215">https://arxiv.org/abs/1102.1215</a>.</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p><b>CartConvert</b> was written by Charles Karney.</p>

<h1 id="HISTORY">HISTORY</h1>

<p><b>CartConvert</b> was added to GeographicLib, <a href="https://geographiclib.sourceforge.io">https://geographiclib.sourceforge.io</a>, in 2009-02. Prior to 2009-03 it was called ECEFConvert.</p>


</body>

</html>


